package edu.java.homework.hw08.ipj10.exer02done;

public class Fruit extends Food {

    // --- Instance Variables --------------------------------------------------

    private String name = null;
    private String colour = null;
    private String sort = null;

    // --- Constructors --------------------------------------------------------

    public Fruit() {
	System.out.println(getClass().getName());
    }

    public Fruit(String taste, int calories, String type, String name) {
	super(taste, calories, type);
	this.name = name;
    }

    public Fruit(String taste, int calories, String type, String name,
	    String colour) {
	this(taste, calories, type, name);
	this.colour = colour;

    }

    public Fruit(String taste, int calories, String type, String name,
	    String colour, String sort) {
	this(taste, calories, type, name, colour);
	this.sort = sort;
    }

    // --- Getters and Setters -------------------------------------------------

    public String getName() {
	return name;
    }

    public void setName(String name) {
	if (name == null) {
	    throw new IllegalArgumentException("Null-pointer string");
	}
	this.name = name;
    }

    public String getColour() {
	return colour;
    }

    public void setColour(String colour) {
	if (colour == null) {
	    throw new IllegalArgumentException("Null-pointer string");
	}
	this.colour = colour;
    }

    public String getSort() {
	return sort;
    }

    public void setSort(String sort) {
	if (sort == null) {
	    throw new IllegalArgumentException("Null-pointer string");
	}
	this.sort = sort;
    }

    // --- Methods -------------------------------------------------------------
    @Override
    public String toString() {
	StringBuilder sb = new StringBuilder();
	sb
		.append("" + getName() + ", " + getColour() + ", " + getSort()
			+ ", ");
	sb.append(super.toString());

	return sb.toString();
    }

}
